package enterprise.manage.entity;

import javax.persistence.*;
import java.util.Calendar;

/**
 * Created by IntelliJ IDEA.
 * User: zhenmingyue
 * Date: 2012-11-20
 * Time: 15:43:21
 * desc: 订单表
 */
@Entity
@org.hibernate.annotations.Entity(dynamicInsert = true, dynamicUpdate = true)
@Table(schema = "mg", name = "order_info")
public class Orders {
    /**
     * id
     */
    private Long id;
    /**
     * 订单号
     */
    private String orderNo;
    /**
     * 用户收获地址Id
     */
//    private Long userAddrId;
    private UserAddr userAddr;
    /**
     * 配送方式
     */
    private String shipWay;
    /**
     * 配送时间
     */
    private String shipTime;
    /**
     * 数量
     */
    private Long quantity;
    /**
     * 价格
     */
    private Double price;
    /**
     * 电池数量
     */
    private Long cellQuantity;
    /**
     * 电池单价
     */
    private Double cellPrice;
    /**
     * 租赁开始时间
     */
    private Calendar leaveBeginTime;
    /**
     * 租赁结束时间
     */
    private Calendar leaveEndTime;
    /**
     * 订单创建时间
     */
    private Calendar createTime;
     /**
     * 物流订单号
     */
    private String logisticsOrderId;

    /**
     * 支付状态  未付款， 已预订， 已发货，已归还，已退款
     */
    private String status;
    /**
     * 支付时间
     */
    private Calendar payTime;

    /**
     * 发货时间
     */
    private Calendar shippingTime;
    /**
     * 还货时间
     */
    private Calendar returnTime;
    /**
     * 退押金时间
     */
    private Calendar paybackTime;

    /**
     * 用户ID
     */
    private User user;
    /**
     * 收货人姓名
     */
    private String consignee;
    /**
     * 收货人地址
     */
    private String consigneeAddress;
    /**
     * 邮编
     */
    private String postcode;
    /**
     * 手机号
     */
    private String mobile;
    /**
     * 固话号
     */
    private String telephone;
    /**
     * 是否完结 -1订单取消 0 订单未完结 1 订单完结
     */
    private Integer finished;
    /**
     * 产品
     */
    private Products product;
    /**
     * 总押金   押金*台数+租金*台数*天数+快递费用=总金额
     */
    private Double amount;
    /**
     * 备注
     */
    private String remark;
    /**
     * 计费起始日期（开始计费时间）    登机日
     */
    private Calendar abroadTime;
    @Id
    @Column(name = "id")
    @GeneratedValue(strategy = GenerationType.AUTO)
    public Long getId() {
        return id;
    }
    @ManyToOne(cascade = {CascadeType.REFRESH},fetch = FetchType.LAZY)
    @JoinColumn(name = "userAddrId")
    public UserAddr getUserAddr() {
        return userAddr;
    }

    public void setUserAddr(UserAddr userAddr) {
        this.userAddr = userAddr;
    }
    @ManyToOne(cascade = {CascadeType.REFRESH},fetch = FetchType.LAZY)
    @JoinColumn(name = "userId")
    public User getUser() {
        return user;
    }

    public void setUser(User user) {
        this.user = user;
    }
    @ManyToOne(cascade = {CascadeType.REFRESH},fetch = FetchType.LAZY)
    @JoinColumn(name = "productId")
    public Products getProduct() {
        return product;
    }

    public void setProduct(Products product) {
        this.product = product;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getOrderNo() {
        return orderNo;
    }

    public void setOrderNo(String orderNo) {
        this.orderNo = orderNo;
    }

    public String getShipWay() {
        return shipWay;
    }

    public void setShipWay(String shipWay) {
        this.shipWay = shipWay;
    }

    public String getShipTime() {
        return shipTime;
    }

    public void setShipTime(String shipTime) {
        this.shipTime = shipTime;
    }

    public Long getQuantity() {
        return quantity;
    }

    public void setQuantity(Long quantity) {
        this.quantity = quantity;
    }

    public Double getPrice() {
        return price;
    }

    public void setPrice(Double price) {
        this.price = price;
    }

    public Long getCellQuantity() {
        return cellQuantity;
    }

    public void setCellQuantity(Long cellQuantity) {
        this.cellQuantity = cellQuantity;
    }

    public Double getCellPrice() {
        return cellPrice;
    }

    public void setCellPrice(Double cellPrice) {
        this.cellPrice = cellPrice;
    }

    public String getLogisticsOrderId() {
        return logisticsOrderId;
    }

    public void setLogisticsOrderId(String logisticsOrderId) {
        this.logisticsOrderId = logisticsOrderId;
    }


    public String getConsignee() {
        return consignee;
    }

    public void setConsignee(String consignee) {
        this.consignee = consignee;
    }

    public String getConsigneeAddress() {
        return consigneeAddress;
    }

    public void setConsigneeAddress(String consigneeAddress) {
        this.consigneeAddress = consigneeAddress;
    }

    public String getPostcode() {
        return postcode;
    }

    public void setPostcode(String postcode) {
        this.postcode = postcode;
    }

    public String getMobile() {
        return mobile;
    }

    public void setMobile(String mobile) {
        this.mobile = mobile;
    }

    public String getTelephone() {
        return telephone;
    }

    public void setTelephone(String telephone) {
        this.telephone = telephone;
    }

    public Calendar getLeaveBeginTime() {
        return leaveBeginTime;
    }

    public void setLeaveBeginTime(Calendar leaveBeginTime) {
        this.leaveBeginTime = leaveBeginTime;
    }

    public Calendar getLeaveEndTime() {
        return leaveEndTime;
    }

    public void setLeaveEndTime(Calendar leaveEndTime) {
        this.leaveEndTime = leaveEndTime;
    }

    public Calendar getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Calendar createTime) {
        this.createTime = createTime;
    }

    public Calendar getPayTime() {
        return payTime;
    }

    public void setPayTime(Calendar payTime) {
        this.payTime = payTime;
    }

    public Calendar getShippingTime() {
        return shippingTime;
    }

    public void setShippingTime(Calendar shippingTime) {
        this.shippingTime = shippingTime;
    }

    public Calendar getReturnTime() {
        return returnTime;
    }

    public void setReturnTime(Calendar returnTime) {
        this.returnTime = returnTime;
    }

    public Calendar getPaybackTime() {
        return paybackTime;
    }

    public void setPaybackTime(Calendar paybackTime) {
        this.paybackTime = paybackTime;
    }

    public Integer getFinished() {
        return finished;
    }

    public void setFinished(Integer finished) {
        this.finished = finished;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public Double getAmount() {
        return amount;
    }

    public void setAmount(Double amount) {
        this.amount = amount;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public Calendar getAbroadTime() {
        return abroadTime;
    }

    public void setAbroadTime(Calendar abroadTime) {
        this.abroadTime = abroadTime;
    }


}

